<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="供应商名称">
              <a-input placeholder="" v-model="queryParam.supplyName" allowClear></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="简称">
              <a-input placeholder="" v-model="queryParam.shortName" allowClear></a-input>
            </a-form-item>
          </a-col>

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="default" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
    </div>

    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange"
      >
        <span slot="action" slot-scope="text, record">
          <!-- <a @click="handleEdit(record)">编辑</a>
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
            <a>删除</a>
          </a-popconfirm> -->
        </span>
        <span slot="bussStatus" slot-scope="text, record">
          <span v-if="text === 1">开业</span>
          <span v-if="text === 0">冻结</span>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <supplySupplier-modal ref="modalForm" @ok="modalFormOk"></supplySupplier-modal>
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import SupplySupplierModal from './modules/SupplySupplierModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'

export default {
  name: 'SupplySupplierList',
  mixins: [JeecgListMixin],
  components: {
    SupplySupplierModal,
  },
  data() {
    return {
      description: '供应商档案管理页面',
      // 表头
      columns: [
        {
          title: '供应商名称',
          align: 'center',
          dataIndex: 'supplyName',
        },
        {
          title: '编号',
          align: 'center',
          dataIndex: 'supplyNo',
        },
        {
          title: '简称',
          align: 'center',
          dataIndex: 'shortName',
        },
        {
          title: '联系人',
          align: 'center',
          dataIndex: 'contractName',
        },
        {
          title: '联系电话',
          align: 'center',
          dataIndex: 'contractTel',
        },
        {
          title: '入驻日期',
          align: 'center',
          dataIndex: 'bussTime',
        },
                {
          title: '入驻状态',
          align: 'center',
          dataIndex: 'bussStatus',
          scopedSlots: { customRender: 'bussStatus' },
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' },
        },
      ],
      url: {
        list: '/stock/supplySupplier/list',
        delete: '/stock/supplySupplier/delete',
        deleteBatch: '/stock/supplySupplier/deleteBatch',
        exportXlsUrl: 'stock/supplySupplier/exportXls',
        importExcelUrl: 'stock/supplySupplier/importExcel',
      },
    }
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    },
  },
  methods: {},
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>